package com.ruoyi.system.mapper;

import com.ruoyi.system.api.domain.SysDept;
import com.ruoyi.system.api.domain.Sysdeptresult;
import com.ruoyi.system.domain.SysDict;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 部门管理 数据层
 *
 * @author ruoyi
 */
@Mapper
public interface SysDictMapper {

    @Select("select * from sys_dict where value=#{value}")
    SysDict selectDictByValue(@Param("value")String value);

    @Select("select * from sys_dict where label=#{label}")
    SysDict selectDictByLabel(@Param("label")String label);

    @Select("SELECT dept_id AS deptId,parent_id AS parentId,dept_name AS deptName,organizationcode  FROM sys_dept WHERE dept_id = #{deptId}")
    Sysdeptresult selectDeptById(@Param("deptId")Long deptId);

    @Select("SELECT dept_id AS deptId,parent_id AS parentId,dept_name AS deptName,organizationcode  FROM sys_dept WHERE dept_name = #{deptname}")
    Sysdeptresult selectDeptByName(@Param("deptname")String deptname);

    int insertDict(SysDict sysDict);
}
